//package zhongbo.java.air.dictionary.web.controller;
//
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.domain.Page;
//import org.springframework.data.domain.PageRequest;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//import zhongbo.java.air.dictionary.model.AirAirport;
//import zhongbo.java.air.dictionary.model.AirAlertZone;
//import zhongbo.java.air.dictionary.service.AirAirportService;
//
//import javax.annotation.Resource;
//import javax.validation.Valid;
//import java.util.List;
//
///**
// * 机场信息表(AirAirport)表控制层
// *
// * @author makejava
// * @since 2025-03-31 14:05:38
// */
//@RestController
//@RequestMapping("airAirport")
//@Api(tags ="机场服务" )
//public class AirAirportController {
//    /**
//     * 服务对象
//     */
//    @Autowired
//    private AirAirportService airAirportService;
//
//    /**
//     * 分页查询
//     *
//     * @param PageNum 页码
//     * @param PageSize      大小
//     * @return 查询结果
//     */
//    @GetMapping
//    @ApiOperation(value = "分页查询", notes = "根据查询消息分页返回列表")
//    public Page<AirAirport> queryByPage(@RequestParam Integer PageNum, @RequestParam Integer PageSize){
//        return airAirportService.queryByPage(PageNum, PageSize);
//    }
//
//    /**
//     * 通过主键查询单条数据
//     *
//     * @param id 主键
//     * @return 单条数据
//     */
//    @GetMapping("{id}")
//    @ApiOperation(value = "用户查询", notes = "通过主键查询单条数据")
//    public ResponseEntity<AirAirport> queryById(@PathVariable("id")  String id) throws Exception {
//        return ResponseEntity.ok(this.airAirportService.queryById(id));
//    }
//
//    /**
//     * 新增数据
//     *
//     * @param airAirport 实体
//     * @return 新增结果
//     */
//    @PostMapping
//    @ApiOperation(value = "新增数据", notes = "新增单条数据")
//    public ResponseEntity<AirAirport> add(@RequestBody @Valid AirAirport airAirport) throws Exception {
//        return ResponseEntity.ok(this.airAirportService.insert(airAirport));
//    }
//
//    /**
//     * 修改数据
//     *
//     * @param airAirport 实体
//     * @return 编辑结果
//     */
//    @PutMapping
//    @ApiOperation(value = "修改数据", notes = "修改单条数据")
//    public ResponseEntity<AirAirport> edit(@RequestBody @Valid AirAirport airAirport) throws Exception {
//        return ResponseEntity.ok(this.airAirportService.update(airAirport));
//    }
//
//    /**
//     * 删除数据
//     *
//     * @param id 主键
//     * @return 删除是否成功
//     */
//    @DeleteMapping
//    @ApiOperation(value = "删除数据", notes = "删除单条数据")
//    public ResponseEntity<Boolean> deleteById( String id) throws Exception {
//        return ResponseEntity.ok(this.airAirportService.deleteById(id));
//    }
//
//}
//
package zhongbo.java.air.dictionary.web.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import zhongbo.java.air.common.vo.PageVo;
import zhongbo.java.air.common.vo.ResultVo;
import zhongbo.java.air.dictionary.model.AirAircraft;
import zhongbo.java.air.dictionary.model.AirAirport;
import zhongbo.java.air.dictionary.model.AirAlertZone;
import zhongbo.java.air.dictionary.service.AirAirportService;


/**
 * 说明：
 * 飞机基础信息操作的相关接口
 *
 * @author 钟波dellNotebook
 * @since 2025年04月01日 星期二 23:20:13
 */
@RestController
@RequestMapping("airPort")
@Api(tags = "机场信息接口")
public class AirAirportController {

    @Autowired
    private AirAirportService<AirAirport> airPortService;

    @PostMapping("add")
    @ApiOperation("添加")
    ResultVo<AirAirport> add(@RequestBody AirAirport entity) throws Exception {
        AirAirport airPort = airPortService.add(entity);
        return ResultVo.ok(airPort);
    }

    @GetMapping("delete")
    @ApiOperation("删除")
    ResultVo<String> delete(String entityId) throws Exception {
        String delete = String.valueOf(airPortService.delete(entityId));
        return ResultVo.ok(delete);
    }

    @PostMapping("edit")
    @ApiOperation("修改")
    ResultVo<AirAirport> edit(@RequestBody AirAirport edit) throws Exception {
        AirAirport airPort = airPortService.edit(edit);
        return ResultVo.ok(airPort);
    }

    @GetMapping("findOne")
    @ApiOperation("查询一条")
    ResultVo<AirAirport> findOne(String entityId) throws Exception {
        AirAirport airPort = airPortService.findOne(entityId);
        return ResultVo.ok(airPort);
    }

//    @GetMapping("findPage")
//    @ApiOperation("分页查询列表")
//    ResultVo<PageVo<AirAirport>> findPage(Integer page, Integer pageSize
//            , String keyword, String fields
//            , String oderByField, Boolean orderByAsc) {
//        PageVo<AirAirport> pageVo = airPortService.findPage(page, pageSize, keyword, fields, oderByField, orderByAsc);
//        return ResultVo.ok(pageVo);
//    }
@GetMapping("findPage")
@ApiOperation("分页查询列表")
ResultVo<PageVo<AirAirport>> findPage(Integer page, Integer pageSize
        , String keyword, String fields
        , String oderByField, Boolean orderByAsc) {
    PageVo<AirAirport> pageVo = airPortService.findPage(page, pageSize, keyword, fields, oderByField, orderByAsc);
    return ResultVo.ok(pageVo);
}

}
